$(document).ready(function() {

      
     // ----- slider ------
      $('#s1').cycle('fade');
     
     // ----- login -------
     function loginFormSubmit(){

          var path = basic_path + 'core/login/signin';

          $.post(path,  
              /*{ "func": "getNameAndTime" },*/
              /*{a:'a'},*/
              $("form[name=login_form]").serialize(),
              function(data){ 
                  if(data.responcestatus == 'ok'){
                      //console.log( data.responcestatus)  
                      $('#login_box').hide()
                      $('#logout_box').show()
                  }    
          }, "json");

          return false;



      } // -- 

      $('form[name=login_form]').unbind('submit').bind('submit',loginFormSubmit);
     
      $('form[name=login_form]').on('keyup',function(e){ 

        if(e.keyCode == '13'){
            $('form[name=login_form]').submit() 
        }

      });
      
      $('#logout_box a').on('click',function(){  
          var path = basic_path + 'core/login/signout';
          
          $.post(path,    
              function(data){ 
                  if(data.responcestatus == 'ok'){
                      console.log( data.responcestatus)  
                      $('#login_box').show()
                      $('#logout_box').hide()
                  }
          }, "json");
      
          return false;
      });

     // ------------ main menu ---------------
     var menu_item_src
      $("div.main-menu-item").hover(

          function(){
              var path = $(this).find("span").text()
              menu_item_src = $(this).find("img").attr("src")
              $(this).find("a").find("img").attr("src",path)
              //console.log(path)
          },
          
          function(){
              $(this).find("a").find("img").attr("src",menu_item_src)
          }

      );
      
      //
      $("ul.tabs li").on('click', change);
    
    
});

function change(){
    $("ul.tabs li.active").removeClass("active")
    $(this).addClass("active")
}

function mypricecheck(value, colname) { console.log(666)
    if (value < 0 || value >20)
        return [false,"Please enter value between 0 and 20"];
    else
        return [true,""];
}